// API 响应基础类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  errors?: ValidationError[];
}

// 验证错误类型
export interface ValidationError {
  type: string;
  msg: string;
  path: string;
  location: string;
}

// 分页响应类型
export interface PaginatedResponse<T> {
  list: T[];
  total: number;
  page: number;
  pageSize: number;
}

// 用户相关类型
export interface User {
  id: number;
  username: string;
  email: string;
  phone: string;
  status: 'active' | 'inactive';
  role: string;
  permissions: string[];
  createTime: string;
}

export interface CreateUserRequest {
  username: string;
  password: string;
  email: string;
  phone?: string;
  role: string;
  status?: 'active' | 'inactive';
}

export interface UpdateUserRequest {
  email?: string;
  phone?: string;
  role?: string;
  status?: 'active' | 'inactive';
}

// 角色相关类型
export interface Role {
  id: number;
  name: string;
  code: string;
  description: string;
  permissions: string[];
  createTime: string;
}

export interface CreateRoleRequest {
  name: string;
  code: string;
  description?: string;
  permissions: string[];
}

export interface UpdateRoleRequest {
  name?: string;
  description?: string;
  permissions?: string[];
}

// 部门相关类型
export interface Department {
  id: number;
  name: string;
  code: string;
  parentId?: number;
  leader: string;
  description: string;
  createTime: string;
  children?: Department[];
}

export interface CreateDepartmentRequest {
  name: string;
  code: string;
  parentId?: number;
  leader: string;
  description?: string;
}

export interface UpdateDepartmentRequest {
  name?: string;
  parentId?: number;
  leader?: string;
  description?: string;
}

// 认证相关类型
export interface LoginRequest {
  username: string;
  password: string;
}

export interface LoginResponse {
  token: string;
  userInfo: User;
  menus: any[];
  buttonPermissions?: string[];
}

export interface UserInfo {
  id: number;
  username: string;
  email: string;
  role: string;
  permissions: string[];
}

// 仪表盘相关类型
export interface DashboardOverview {
  totalUsers: number;
  activeUsers: number;
  totalRoles: number;
  totalDepartments: number;
  todayActiveUsers: number;
  thisWeekActiveUsers: number;
  thisMonthActiveUsers: number;
}

export interface UserGrowth {
  date: string;
  users: number;
  activeUsers: number;
}

export interface UserDistribution {
  roleDistribution: Array<{ name: string; value: number }>;
  deptDistribution: Array<{ name: string; value: number }>;
  statusDistribution: Array<{ name: string; value: number }>;
}

export interface RecentActivity {
  id: number;
  type: string;
  user: string;
  description: string;
  timestamp: string;
}

export interface SystemPerformance {
  cpu: number;
  memory: number;
  disk: number;
  network: number;
  responseTime: number;
  uptime: number;
  requestsPerSecond: number;
}

export interface PageView {
  page: string;
  views: number;
}

// 权限相关类型
export interface Permission {
  code: string;
  name: string;
  description: string;
} 